#include <iostream>
#include <vector>

using namespace std;

namespace ltw
{
    class Solution
    {
        bool hash[1010] = {0};

    public:
        vector<int> intersection(vector<int>& nums1, vector<int>& nums2)
        {
            vector<int> ret;
            for(auto x : nums1)
            {
                hash[x] = true;
            }

            for(auto x : nums2)
            {
                if(hash[x])
                {
                    ret.push_back(x);
                    hash[x] = false;
                }
            }

            return ret;
        }
    };
} // namespace ltw

